package com.huifai.common.exception;

import com.huifai.common.constant.ERespCode;

public class BaseException extends Exception {

    private static final long serialVersionUID = -3222145047616133245L;
    
    protected int code;
    protected String message;

    public BaseException() {
    }

    public BaseException(ERespCode businessCode) {
        super(businessCode.message());
        this.message = businessCode.message();
        this.code = businessCode.code();
    }

    public BaseException(int code, String message) {
        super(message);
        this.message = message;
        this.code = code;
    }

    public BaseException(int code, String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.message = message;
        this.code = code;
    }

    public BaseException(int code, String message, Throwable cause) {
        super(message, cause);
        this.message = message;
        this.code = code;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
    
}
